﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IUnitOfWork.cs" company="emrecoskun.net">
//   ecblog.codeplex.com - emrecoskun.net
// </copyright>
// <summary>
//   The unit of work interface
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace EcBlog.Data.Base
{
    using System;
    using System.Collections.Generic;

    using EC.Models;

    /// <summary>
    /// The unit of work interface
    /// </summary>
    public interface IUnitOfWork : IDisposable
    {
        /// <summary>
        /// Creates the history repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns>The history repository</returns>
        IHistoryRepository<TEntity> CreateHistoryRepository<TEntity>() where TEntity : class, new();

        /// <summary>
        /// Gets the enum key value list.
        /// </summary>
        /// <typeparam name="TEnum">The type of the enum.</typeparam>
        /// <returns>The enum key value list</returns>
        List<KeyValue> GetEnumKeyValueList<TEnum>();

        /// <summary>
        /// Gets the entity list with raw SQL.
        /// </summary>
        /// <typeparam name="TEnitity">The type of the enitity.</typeparam>
        /// <param name="query">The query.</param>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The entity list</returns>
        IEnumerable<TEnitity> GetWithRawSql<TEnitity>(string query, params object[] parameters) where TEnitity : class;

        /// <summary>
        /// Saves this instance.
        /// </summary>
        void Save();
    }
}